package com.xckj.cycling.dialog

import android.content.Context
import android.os.Bundle
import android.text.TextUtils
import android.view.ViewGroup
import com.xckj.cycling.databinding.DialogAddCommentBinding

class AddCommentDialog(context: Context, private val callback: CommentCallback) :
    BaseDialog(context) {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val vb = DialogAddCommentBinding.inflate(
            layoutInflater,
            window?.decorView as ViewGroup?, false
        )
        setContentView(vb.root)
        vb.confirm.setOnClickListener {
            vb.et.text.toString().let {
                if (!TextUtils.isEmpty(it)) {
                    callback.callback(vb.et.text.toString())
                    dismiss()
                }
            }

        }
    }

    interface CommentCallback {
        fun callback(content: String)
    }
}